#include <unordered_set>
#include <iostream>
#include <iomanip>

using namespace std;

typedef unsigned char byte;

int main()
{
	for(int output_diff = 0; output_diff <= 0xff; ++output_diff)
	{
		unordered_set<int> diff_set;
		int try_in_diff;
		for(try_in_diff = 0; try_in_diff <= 0xff; ++try_in_diff)
		{
			int found = 0;
			for( int try_in = 0; try_in <= 0xff; ++try_in)
			{
				byte try_in_e = try_in ^ try_in_diff;
				for(int try_adder = 0; try_adder <= 0xff; ++try_adder)
				{
					byte output,output_e;
					output = try_in + try_adder;
					output_e = try_in_e + try_adder;
					byte try_output_diff = output ^ output_e;
					if(try_output_diff == output_diff)
					{
						//printf("found a result.in=%x,in_e=%x,adder=%x\n", try_in, try_in_e, try_adder);
						found = 1;
						break;
					}
				}
				if(found)
					break;
			}
			if(found)
				diff_set.insert(try_in_diff);
		}
		cout<<"Out diff:"<<hex<<output_diff<<";size:"<<dec<<diff_set.size()<<endl;
		for(unordered_set<int>::iterator it = diff_set.begin();
			it != diff_set.end();
			++it)
		{
			cout<<*it<<" ";
		}
		cout<<endl;
	}
	return 0;
}
